using System;
using Deepcode.Flux.Core.Codons;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Extensions.Codons;
using Deepcode.Flux.Core.Systems.Security;

namespace Deepcode.Flux.Core.Codons.Security
{
	/// <summary>
	/// <PermissionGroup 
	///		id="CMSPermissions" 
	///		title="Content and Asset Management">
	/// 
	/// Codon representing a group of permissions available for binding to user groups
	/// 
	/// </summary>
	[XmlCodonName("PermissionGroup")]
	public class PermissionGroupCodon: AbstractCodon
	{
		[XmlCodonAttribute("title")]
		private string title = "";

		public override object BuildItem(object owner, System.Collections.ArrayList subItems)
		{
			if( subItems.Count <1 ) return null;
			PermissionGroup g = new PermissionGroup( title, subItems );
			return g;
		}
	}
}
